
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Serialization;


public class BuffEffect_ManualRefreshListener : BaseBuffModule
{
    public int delta_hp;
    public int delta_atk;

    public override void Apply(BuffInfo buffInfo, DamageInfo damageInfo = null)
    {
        BdPackage.BdUtils.assert(buffInfo != null);
        BdPackage.BdUtils.assert(buffInfo.creator != null);
        BdPackage.BdUtils.assert(buffInfo.target != null);
        BdPackage.BdUtils.log($"-------- on BuffEffect_ManualRefreshListener! creator: {buffInfo.creator.name}, target: {buffInfo.target.name}, delta_hp: {delta_hp}, delta_atk: {delta_atk}");
        
        var card = buffInfo.target.GetComponent<CardController>();
        BdPackage.BdUtils.assert(card, $"obj[{buffInfo.target.name}]的组件 CardController 为空?");
        BdPackage.BdUtils.assert(card != null);
        
        var new_hp = card.curr_hp + delta_hp;
        var new_atk = card.curr_atk + delta_atk;

        card.set_current_atk_and_hp_value(atk: new_atk, hp: new_hp, use_do_tween: true);
    }
}
